package cn.wolfcode.domain;

import com.alibaba.fastjson.JSON;
import lombok.Data;

@Data
public class MenuCatalogue {

    public static final int STATUS_TYPE_PERFORM = 0;  // 目录  启用
    public static final int STATUS_TYPE_CONSUME = 1;  // 菜单   禁用
    /** */
    private Long id;

    /** 菜单名称*/
    private String name;

    /** 菜单URL*/
    private String url;

    /** 权限表达式*/
    private String jurisdiction;

    /** 排序*/
    private Integer ranking;

    /** 状态*/
    private Integer status = STATUS_TYPE_PERFORM;

    /** 菜单类型*/
    private Integer menuType = STATUS_TYPE_PERFORM;

    /** 上级菜单id*/
    private Integer superiorId;

    /** 上级菜单*/
    private String superiorName;



    public String getMenuTypeDisplay(){
        switch (menuType){
            case STATUS_TYPE_PERFORM : return "目录";
            case STATUS_TYPE_CONSUME : return "菜单";
            default: return "异常状态";
        }
    }

    public String getStatusDisplay() {
        switch (status) {
            case STATUS_TYPE_PERFORM:
                return "启用中";
            case STATUS_TYPE_CONSUME:
                return "禁用中";
            default:
                return "异常状态";
        }
    }

    public String toJson() {
        return JSON.toJSONString(this);
    }
}